package com.Arsanesia.TempleRush.Views.Screens.Components.PopUp;

import com.Arsanesia.TempleRush.TempleRush;
import com.Arsanesia.TempleRush.Controllers.World;
import com.Arsanesia.TempleRush.Controllers.Listeners.QuitAttemptListener;
import com.Arsanesia.TempleRush.Views.Screens.AbstractScreen;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.scenes.scene2d.actions.Actions;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;

public class QuitAttemptPopup {
	private Image quitAttempt;
	
	public QuitAttemptPopup(TextureAtlas atlas, TempleRush game, World world){
		//create quitAttempt
		quitAttempt= new Image(new TextureRegionDrawable(new TextureRegion(atlas.createSprite("quit"))));
		quitAttempt.setPosition((AbstractScreen.VIEWPORT_DEFAULTWIDTH-quitAttempt.getWidth())/2, (AbstractScreen.VIEWPORT_DEFAULTHEIGHT-quitAttempt.getHeight())/2);
		quitAttempt.addListener(new QuitAttemptListener(game,quitAttempt, world));
		quitAttempt.addAction(Actions.alpha(0));
	}
	public void setQuitVisible(){
		quitAttempt.addAction(Actions.alpha(1));
	}
	public void setQuitInvisible(){
		quitAttempt.addAction(Actions.alpha(0));
	}
	public Image getQuitImage(){
		return this.quitAttempt;
	}
	public boolean canBeDrawn(){
		return this.quitAttempt.getColor().a == 1;
	}
}
